home *** CD-ROM | disk | FTP | other *** search
- Path: enterprise.turningpoint.com!loki
- From: sathan@cybercom.net (Stephen Athanas)
- Newsgroups: comp.lang.c++
- Subject: Possible VC 4.0 bug?
- Date: 31 Jan 1996 22:39:52 GMT
- Organization: Turning Point Software
- Message-ID: <4eor3o$d06@enterprise.turningpoint.com>
- NNTP-Posting-Host: steve.turningpoint.com
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- When I compile and run the following code under MSVC 4.0, I get an access
- violation on the delete:
-
- -------------------------------------------------------------------------
-
- #include <stdio.h>
-
- class foo
- {
- public :
- virtual ~foo( );
- };
-
- foo::~foo( )
- {
- printf( "In foo::~foo.\n" );
- }
-
- int main( )
- {
- foo* p = new foo[ 0 ];
-
- delete [] p;
-
- return 0;
- }
-
- --------------------------------------------------------------------------
-
- Everything works fine, and the destructor is never called, if the destructor
- is not virtual.
-
- Is this a problem with VC, or with my understanding of how a new of size zero
- should work? Thanks.
-
- Steve Athanas
- sathan@cybercom.net
-